/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package IHM;

import Modele.Graphique;
import Modele.Hexagon;
import Modele.Lapin;
import Modele.Pont;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.LinkedList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JPanel;

/**
 *
 * @author Zanna Bianca
 */
public class PlanDuJeu extends JPanel {

    private final List<Hexagon> hexagon = new LinkedList<Hexagon>();
    private final List<Pont> pont = new LinkedList<Pont>();
    private final List<Lapin> lapin = new LinkedList<Lapin>();
    private final List<Graphique> graphique = new LinkedList<Graphique>();
    private final List<Pont> barriere = new LinkedList<Pont>();
    private int ligne;
    private int nbreLapinParJoueur = 3;
    private Hexagon premierCoup;
    private double longueurCote = Hexagon.getLONGUEURDESHEXAGONS();

    public PlanDuJeu() {
        this(3);
    }

    public PlanDuJeu(int colonne) {
        super();
        this.ligne = colonne;
        this.setSize(800, 800);
        setBorder(BorderFactory.createTitledBorder("Jeu Enclos"));

    }

    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);

    }

    private Hexagon placerHexagonPoint(int x, int y) {
        for (Hexagon hex : hexagon) {
            if (hex.getVirIndex().getX() == x) {
                if (hex.getVirIndex().getY() == y) {
                    return hex;
                }
            }
        }
        return null;
    }

    private void ajouterLesBarriere(Graphics2D g1) {
        g1.setColor(Color.BLACK);
        for (Pont bar : this.barriere) {
            g1.drawPolygon(bar.getPol());
        }
    }

    private void ajouterUneCase() {
        // Case Hexagon
        hexagon.add(new Hexagon(0, 0));
        while (ligne <= 3) {
            for (int colonne = 0; colonne < ligne * 6; colonne++) {
                hexagon.add(new Hexagon(ligne, colonne));
            }
        }
        //Case Pont
        int nbrePont = this.nombrePont();
        for(int i = 0; i < nbrePont; i++){
            this.pont.add(new Pont());
        }

    }

    private int nombrePont() {
        int nbrePont = 0;
        int i = 0;
        while (i < this.ligne * 3) {
            nbrePont += i * 6;
            i += 3;
        }
        nbrePont += ligne*6;
        return nbrePont;
    }
    
    
    

}
